package com.akcome.apollo.controller;

import java.util.Locale;

import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.RequestMapping;

import com.akcome.apollo.common.ApolloConstants;
import com.akcome.apollo.service.BmpAccountService;

/**
 * 帮助中心
 * @author wn
 *
 */
@Controller
@RequestMapping("/help")
public class HelpController {
	
	@Autowired
	private BmpAccountService bmpAccountService;

	/**
	 * 帮助与支持
	 * @return
	 */
	@RequestMapping("/help")
	public String support(@CookieValue(required = false,value=ApolloConstants.COOKIE_ACCOUNT) Long c_accountId,  ModelMap modelMap,HttpServletResponse response){
		bmpAccountService.homeSetting(modelMap, c_accountId, response);
		Locale locale = LocaleContextHolder.getLocale();
		if(Locale.SIMPLIFIED_CHINESE.equals(locale)){
			return "help/help";
		}else{
			return "help/help_en";
		}
	}
	
	/**
	 * 挖矿计算器
	 * @return
	 */
	@RequestMapping("/calculator")
	public String calculator(@CookieValue(required = false,value=ApolloConstants.COOKIE_ACCOUNT) Long c_accountId,  ModelMap modelMap,HttpServletResponse response){
		bmpAccountService.homeSetting(modelMap, c_accountId, response);
		return "help/calculator";
	}
	
}
